#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+100;
typedef int LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
struct P{
  LL val,id;
}a[maxn];
LL dif=0;
map<LL,LL>map1;
bool cmp(P A,P B){return A.val<B.val;}
void add(LL v){
    map1[v]++;
    if(map1[v]==1) dif++;
}
void rem(LL v){
    map1[v]--;
    if(map1[v]==0) dif--;
}
int main(void)
{
  LL n;n=read();
  for(LL i=1;i<=n;i++) a[i].val=read(),a[i].id=i;
  sort(a+1,a+1+n,cmp);
  for(LL i=1;i<n;i++){
    add(a[i+1].val-a[i].val);
  }
  ///LL num1=s.count( (*s.begin()));
  ///LL num2=s.count( (*s.end()) );

  if(map1.size()>=4){
    printf("-1\n");
    return 0;
  }
  bool flag=1;
  LL last=a[1].val;
  for(LL i=1;i<=n;i++){
    /*if(i>1&&a[i].val==last&&a[i+1].val==last) {
            last=a[i].val;
            continue;
    }*/
    if(i<n)  rem( a[i+1].val-a[i].val);
    if(i>=2) rem( a[i].val-a[i-1].val);
    if(i>=2&&i<n) add( a[i+1].val-a[i-1].val);

    /*for(auto j:map1){
        cout<<j.first<<" "<<j.second<<"\n";
    }
    cout<<"\n";*/

    if(dif<=1){
        flag=0;
        printf("%d\n",a[i].id);
        break;
    }
    if(i<n)  add(a[i+1].val-a[i].val);
    if(i>=2) add(a[i].val-a[i-1].val);
    if(i>=2&&i<n) rem( a[i+1].val-a[i-1].val);
    ///last=a[i].val;
  }
  if(1==flag) printf("-1\n");
return 0;
}
